package com.jbit.common;

import com.alibaba.fastjson.JSON;
import jdk.nashorn.internal.ir.debug.JSONWriter;
import lombok.Data;

@Data
public class RedisEntity {
    private String key;
    private String value;
    private Integer expire;
    private RedisEntity(){}
    public static RedisEntity send(String key,Object value,Integer expire){
        RedisEntity redisEntity = new RedisEntity();
        redisEntity.key = key;
        redisEntity.value = JSON.toJSONString(value);
        redisEntity.expire = expire;
        return redisEntity;
    }

    public static RedisEntity send(String key,Object value){
        RedisEntity redisEntity = new RedisEntity();
        redisEntity.key = key;
        redisEntity.value = JSON.toJSONString(value);
        return redisEntity;
    }

    public static RedisEntity send(String key){
        RedisEntity redisEntity = new RedisEntity();
        redisEntity.key = key;
        return redisEntity;
    }
}
